var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { jsx as _jsx } from "react/jsx-runtime";
import { Popup } from "devextreme-react";
import React, { PureComponent } from "react";
import { InputPopup } from "./DevInputPopup";
import { DevLogicPopup } from "./DevLogicPopup";
//测试提交前检测
function DevDefaultPopups(WrappedComponent) {
    return class extends PureComponent {
        static Default;
        static Input;
        static Logic;
        state = {
            Visible: false,
            title: "",
        };
        gridRef;
        defaultConfig = {
            maxWidth: "960",
            minWidth: "480",
            width: "480",
            height: "200",
        };
        show = (params) => {
            this.gridRef.current.refs = params;
            this.setState({
                Visible: true,
                title: params.title,
            });
        };
        render() {
            this.gridRef = React.createRef();
            let props = {
                ...this.defaultConfig,
                ...this.props,
            };
            return (_jsx(WrappedComponent, { ...props, ref: this.gridRef, title: this.state.title, visible: this.state.Visible, onHiding: () => {
                    this.setState({
                        Visible: false,
                    });
                    if (this.gridRef.current?.refs?.onCancel) {
                        this.gridRef.current?.refs?.onCancel();
                    }
                }, toolbarItems: [
                    {
                        widget: "dxButton",
                        toolbar: "bottom",
                        location: "after",
                        options: {
                            text: "取消",
                            onClick: () => {
                                this.setState({
                                    Visible: false,
                                });
                                if (this.gridRef.current?.refs?.onCancel) {
                                    this.gridRef.current?.refs?.onCancel();
                                }
                            },
                        },
                    },
                    {
                        widget: "dxButton",
                        toolbar: "bottom",
                        location: "after",
                        options: {
                            text: "确定",
                            type: "default",
                            onClick: () => {
                                this.setState({
                                    Visible: false,
                                });
                                this.gridRef.current?.refs?.okCallback();
                            },
                        },
                    },
                ], children: this.props.children() }));
        }
    };
}
/**
 * ## 基于DevExpress DevPopup进行的二次封装组件
 * ~~~js
 * import DevPopup  from 'sright-ui'
 * ~~~
 * [DevPopup连接](https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxPopup/?search=Popup)
 *
 * ### 介绍
 * 1. <DevDefaultPopup.Default/> :
 *  1.1、封装默认通用配置，提供弹出框通用功能的基础组件 。
 *  1.2、该组件通过 ref 进行调用和传递参数,具体使用参考案例。
 *  1.3、参数为 title: "标题", okCallback:"点击 确定的回调函数"。
 * 2. <DevDefaultPopup.Input/> :
 *  2.1、内制单一input输入框
 *  2.2、该组件通过 ref 进行调用和传递参数,具体使用参考案例。。
 *  2.3、参数为 title: "标题", okCallback:"点击 确定的回调函数" ,  value:"数据"。
 * 3. <DevDefaultPopup.Logic/> :
 *  3.1、DevDefaultPopup.Logic 基于本地数据 进行业务逻辑演示 可参考DATA_BS中的LogicPopup组件
 */
export class DevPopup extends PureComponent {
    static Default;
    static Input;
    static Logic;
}
// 默认弹出框组件
let DevDefaultPopup = class DevDefaultPopup extends PureComponent {
    render() {
        return _jsx(Popup, { ...this.props });
    }
};
DevDefaultPopup = __decorate([
    DevDefaultPopups
], DevDefaultPopup);
export { DevDefaultPopup };
// 弹出框 业务逻辑
let DevLogicPopups = class DevLogicPopups extends PureComponent {
    render() {
        return _jsx(Popup, { ...this.props });
    }
};
DevLogicPopups = __decorate([
    DevLogicPopup
], DevLogicPopups);
export { DevLogicPopups };
// 增强input组件
let DevInputPopup = class DevInputPopup extends PureComponent {
    render() {
        return _jsx(Popup, { ...this.props });
    }
};
DevInputPopup = __decorate([
    InputPopup
], DevInputPopup);
export { DevInputPopup };
export default DevPopup;
